<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Basic Form </title>

    <!-- ================= Favicon ================== -->

    <!-- Styles -->
    <link href="__VIS__/css/lib/font-awesome.min.css" rel="stylesheet">
    <link href="__VIS__/css/lib/themify-icons.css" rel="stylesheet">
    <link href="__VIS__/css/lib/menubar/sidebar.css" rel="stylesheet">
    <link href="__VIS__/css/lib/bootstrap.min.css" rel="stylesheet">
    <link href="__VIS__/css/lib/unix.css" rel="stylesheet">
    <link href="__VIS__/css/style.css" rel="stylesheet">
</head>

<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-lg-8 p-r-0 title-margin-right">
            <div class="page-header">
                <div class="page-title">
                    <h1>邮件设置</h1>
                </div>
            </div>
        </div>
        <!-- /# column -->
        <div class="col-lg-4 p-l-0 title-margin-left">
            <div class="page-header">
                <div class="page-title">
                    <ol class="breadcrumb text-right">
                        <li><a href="#">系统设置</a></li>
                        <li><a href="{:url('index')}">Url美化列表</a></li>
                        <li class="active">添加修改</li>
                    </ol>
                </div>
            </div>
        </div>
        <!-- /# column -->
    </div>
    <!-- /# row -->
    <section id="main-content">
        <div class="row">
            <div class="col-lg-12">
                <div class="card alert">
                    <div class="card-header">
                        <h4>添加修改Url美化</h4>
                        <div class="card-header-right-icon">
                            <ul>
                                <li class="card-close" data-dismiss="alert"><i class="ti-close"></i></li>
                                <li class="doc-link"><a href="#"><i class="ti-link"></i></a></li>
                                <li class="page-refresh"><i class="fa fa-refresh"></i> 刷新页面</li>
                            </ul>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="basic-elements">
                            <form class="vis_form">
                                <div class="row">
                                    <div class="col-lg-6">
                                        <div class="form-group">
                                            <label>原地址</label>
                                            <input type="text" name="url" class="form-control" placeholder="请输入"  {notempty name="$data.url"}value="{$data.url}"{/notempty}>
                                            <span class="help-block">
														<small>例：admin/basic/login</small>
													</span>
                                        </div>
                                        <div class="form-group">
                                            <label>路由</label>
                                            <input type="text" name="aliases" class="form-control" placeholder="请输入"  {notempty name="$data.aliases"}value="{$data.aliases}"{/notempty}>
                                            <span class="help-block">
														<small>例：login(如有参数：login/:id)</small>
													</span>
                                        </div>

                                        <div class="form-group">
                                            <label>描述</label>
                                            <textarea class="form-control" rows="4" placeholder="Text input" name="desc">{notempty name="$data.desc"}{$data.desc}{/notempty}</textarea>
                                        </div>
                                        {notempty name="$data"}
                                        <input type="hidden" name="id" value="{$data.id}">
                                        {/notempty}
                                        <div class="form-group">
                                            <a href="#" class="btn btn-default btn-outline vis_form_btn">立即提交</a>


                                        </div>
                                    </div>

                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /# column -->
            <!-- /# column -->
        </div>
        <!-- /# row -->



    </section>
</div>





<div id="search">
    <button type="button" class="close">×</button>
    <form>
        <input type="search" value="" placeholder="type keyword(s) here" />
        <button type="submit" class="btn btn-primary">Search</button>
    </form>
</div>
<!-- jquery vendor -->
<script src="__VIS__/js/lib/jquery.min.js"></script>
<script src="__VIS__/js/lib/jquery.nanoscroller.min.js"></script>
<!-- nano scroller -->
<script src="__VIS__/js/lib/menubar/sidebar.js"></script>
<script src="__VIS__/js/lib/preloader/pace.min.js"></script>
<!-- sidebar -->
<script src="__VIS__/js/lib/bootstrap.min.js"></script>
<!-- bootstrap -->
<script src="__VIS__/js/layer/layer.js"></script>
<!-- scripit init-->
<script>
    $('.page-refresh').on("click", function() {
        location.reload();
    });
    $('.vis_form_btn').click(function () {
        $.ajax({
            url:"{:url('admin/urls/edit')}",
            type:'POST',
            dataType:'JSON',
            data:$('.vis_form').serialize(),
            success:function (res) {
                if(res.code == 1){
                    layer.msg(res.msg,{icon:6},function () {
                        window.location.href=res.url;
                    })
                }else {
                    layer.msg(res.msg,{icon:5})
                }
            }
        })
    });

</script>




</body>

</html>